Ext.define('component.customer.cusFormPanel', {
	extend : 'Ext.form.Panel',
	initComponent:function(){
	
	var gridStore = Ext.create('Ext.data.Store', {
        fields: ["id","createTime","combinedName", "userName","taskUserName","auditStatus","smTartTime","ckEndTime"
                 ,"businessStatus","isPaydeposit","customerId"],
        pageSize: 10,  //页容量5条数据
        //是否在服务端排序 （true的话，在客户端就不能排序）
        remoteSort: false,
        proxy: {
            type: 'ajax',
            url: jypath+'/customer/payDeposit/list',
            actionMethods: { read: 'POST' },
            reader: {   //这里的reader为数据存储组织的地方，下面的配置是为json格式的数据，例如：[{"total":50,"rows":[{"a":"3","b":"4"}]}]
                type: 'json', //返回数据类型为json格式
                root: 'rows',  //数据
                totalProperty: 'total' //数据总条数
            }
        },
//        timeout:3000000,
        autoLoad: false  //即时加载数据
    });
	
	gridStore.on("beforeload",function(){
        Ext.apply(gridStore.proxy.extraParams,{customerId:customerId});
    });
	
	
	var grid = Ext.create('Ext.grid.Panel', {
		id:"gridStoreList1",
		minHeight:600,
        store: gridStore,
        columnLines: true,
        columns: [{
            text: '认筹日期',
            dataIndex: 'createTime',
            renderer:function(value){
            	return Ext.Date.format(new Date(value),'Y-m-d')
            }
        },{
            text     : '是否无房认筹',
            dataIndex: 'isPaydeposit',
            renderer:function(val){
            	if (val == 0) {
                    return '否';
                } else if (val == 1) {
                    return '是';
                }
                return val;
            }
        },{
            text     : '认筹房源',
            width : 350,
            dataIndex: 'combinedName'
        },{
            text     : '经纪人',
            dataIndex: 'userName'
        },{
            text     : '审核人',
            dataIndex: 'taskUserName'
        },{
            text     : '审核结果',
            dataIndex: 'auditStatus',
            renderer : function(val) {
                if (val == 0) {
                    return '待提交';
                } else if (val == 1) {
                    return '审核中';
                }else if (val == 2) {
                    return '驳回';
                }else if (val == 3) {
                    return '成功';
                }
                return val;
            }
        },{
            text: '提交时间',
            dataIndex: 'smTartTime',
            renderer:function(value){
            	if(value)
            	return Ext.Date.format(new Date(value),'Y-m-d G:i:s')
            }
        },{
            text: '审核时间',
            dataIndex: 'ckEndTime',
            renderer:function(value){
            	if(value)
            	return Ext.Date.format(new Date(value),'Y-m-d G:i:s')
            }
        },{
            text     : '业务状态',
            dataIndex: 'businessStatus',
            renderer : function(val) {
                if (val == 1) {
                    return '认筹';
                } else if (val == 2) {
                    return '认筹转认购';
                }else if (val == 3) {
                    return '认筹转签约';
                }else if (val == 4) {
                    return '已更名';
                }else if (val == 5) {
                    return '退认筹';
                }
                return val;
            }
        },{  
        	text : "操作",  
            dataIndex: 'actioncolumn',
            renderer: function(value,cellmeta,record,rowIndex,columnIndex,store) {
                var rec = grid.getStore().getAt(rowIndex);
                //查看
                return html = "<a href='"+jypath+"/customer/payDeposit/toView?id="+rec.get('id')+"&returnUrl=,customer,customer,toDetail(customerId)"+rec.get('customerId')+"' style='cursor:pointer'>查看</a>"
            }
        }],
        title: '认筹列表',
        dockedItems: [{  
            xtype: 'pagingtoolbar',  
            store: gridStore,   // GridPanel中使用的数据  
            dock: 'bottom',  
            displayInfo: true,  
            emptyMsg:"没有数据",  
            displayMsg:"显示从{0}条数据到{1}条数据，共{2}条数据"
        }
        ]
    });
	
		
		var defaultConfig = {
				defaults: {  
		            split: true,    //有分割线  
		            collapsible: true,  //可以折叠
		        },
				items:[grid]
		};
		Ext.apply(this,defaultConfig);
		this.callParent(arguments);
		
	}
});
